import 'dart:io';

import 'package:flutter/material.dart';
import 'package:test1/FirstPage.dart';
import 'package:test1/SecondPage.dart';

class TabBarPage extends StatelessWidget{

  final List<Tab> myTabs = <Tab>[
    Tab(text: '选项1'),
    Tab(text: '选项2'),
  ];
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: DefaultTabController(
        length: myTabs.length,
        child: Scaffold(
          appBar: AppBar(
            bottom: TabBar(
              tabs: myTabs,
            ),
          ),
          body: TabBarView(
            children: myTabs.map((Tab tab){
              return Center(child: Text(tab.text.toString()));
            }).toList(),
          ),
        ),
      ),
    );
  }

}


